<?php

namespace App\Transformers;

use App\Models\Integrallog;
use League\Fractal\TransformerAbstract;

class IntegralLogTransFormer extends TransformerAbstract
{
    public function transform(Integrallog $integrallog)
    {
        return [
            'id' => $integrallog->id,
            'title' =>$integrallog->title ?? '',
            'title_text' =>$integrallog->titleEnum[$integrallog->title] ?? '',
            'user_id' =>$integrallog->user_id ?? '',
            'front_integral' =>$integrallog->front_integral ?? '',
            'get_points' =>$integrallog->get_points ?? '',
            'remarks' =>$integrallog->remarks ?? '',
            'created_at' => $integrallog->created_at ? $integrallog->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $integrallog->updated_at ? $integrallog->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
